package 多线程;

import java.util.concurrent.TimeUnit;

public class T5 {
    public static void main(String[] args) {
        Thread t0=new Thread(()->{
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("死锁一秒中");
            System.out.println(Thread.currentThread().getName());
           System.out.println(Thread.currentThread().getPriority());},"ttt1");
       // t0.setName("我是线程0");
        t0.setPriority(Thread.MIN_PRIORITY);
        t0.start();

        //设置线程
        Thread.currentThread().setName("主线程");
        //设置优先级 1 - 10
        Thread.currentThread().setPriority(10);
        try {
            //Thread.sleep(10000);
            TimeUnit.SECONDS.sleep(2);
            System.out.println(Thread.currentThread().getName());
            System.out.println(Thread.currentThread().getPriority());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
